package org.meetunexpectedly.Lock;

/**
 * @Description: 锁
 * @Author: pupil
 * @Date: 2024/09/19 下午 5:07
 */
public interface ILock {
    /**
     * 尝试获取锁
     * @param timeoutSec 锁持有的超时时间，过期后自动释放
     * @return true代表获取锁成功；false代表获取锁失败
     */
    boolean tryLock(long timeoutSec);

    /**
     * 释放锁
     */
    void unlock();
}
